#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main() {
    int a;
    scanf("%d", &a);
    int arr[a];
    for (int i = 0; i < a; i++)
    {
        scanf("%d", &arr[i]);
    }
    int t = 0;
    for (int i = 0; i < a - 1; i++)
    {
        int count = 0;
        for (int j = 0; j < a - i - 1; j++)
        {
            if (arr[j] > arr[j + 1])
            {
                t = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = t;
                count = 1;
            }
        }
        if (count == 0)
            break;
    }
    for (int i = a - 1; i > a - 6; i--)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}